using Engine;
using Game;
using SCIENEW;

namespace Game {
    public class CrafterIconWidget : BlockIconWidget {
        public new int Value {
            get => m_value;
            private set => m_value = value;
        }

        int m_heat;

        public int RequiredHeatLevel {
            get => m_heat;
            set {
                m_heat = value;
                UpdateCrafters();
            }
        }

        int[] carftersID;

        void UpdateCrafters() {
            carftersID = IECrafterManager.GetCrafterDevice(m_heat);
        }

        public override void Update() {
            base.Update();
            if(carftersID != null && carftersID.Length > 0) {
                int crafterID = carftersID[(int)(1.0 * Time.RealTime) % carftersID.Length];
                Value = crafterID;
            }
        }
    }
}